package com.ruoyi.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.DeviceMainMapper;
import com.ruoyi.domain.DeviceMain;
import com.ruoyi.service.IDeviceMainService;

/**
 * 设备主表Service业务层处理
 * 
 * @author jack
 * @date 2025-01-05
 */
@Service
public class DeviceMainServiceImpl implements IDeviceMainService 
{
    @Autowired
    private DeviceMainMapper deviceMainMapper;

    /**
     * 查询设备主表
     * 
     * @param id 设备主表主键
     * @return 设备主表
     */
    @Override
    public DeviceMain selectDeviceMainById(Long id)
    {
        return deviceMainMapper.selectDeviceMainById(id);
    }

    /**
     * 查询设备主表
     *
     * @param sn 设备主表主键
     * @return 设备主表
     */
    @Override
    public DeviceMain selectDeviceMainBySn(String sn)
    {
        return deviceMainMapper.selectDeviceMainBySn(sn);
    }

    /**
     * 查询设备主表列表
     * 
     * @param deviceMain 设备主表
     * @return 设备主表
     */
    @Override
    public List<DeviceMain> selectDeviceMainList(DeviceMain deviceMain)
    {
        return deviceMainMapper.selectDeviceMainList(deviceMain);
    }

    /**
     * 新增设备主表
     * 
     * @param deviceMain 设备主表
     * @return 结果
     */
    @Override
    public int insertDeviceMain(DeviceMain deviceMain)
    {
        deviceMain.setCreateTime(DateUtils.getNowDate());
        return deviceMainMapper.insertDeviceMain(deviceMain);
    }

    /**
     * 修改设备主表
     * 
     * @param deviceMain 设备主表
     * @return 结果
     */
    @Override
    public int updateDeviceMain(DeviceMain deviceMain)
    {
        return deviceMainMapper.updateDeviceMain(deviceMain);
    }

    /**
     * 批量删除设备主表
     * 
     * @param ids 需要删除的设备主表主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMainByIds(Long[] ids)
    {
        return deviceMainMapper.deleteDeviceMainByIds(ids);
    }

    /**
     * 删除设备主表信息
     * 
     * @param id 设备主表主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMainById(Long id)
    {
        return deviceMainMapper.deleteDeviceMainById(id);
    }
}
